package com.canton.dao.repository;

import com.canton.dao.entity.MethodNode;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @Author: Sure
 * @Date: 2022-04-25 20:33
 */
public interface MethodRepository extends Neo4jRepository<MethodNode,Long>, CrudRepository<MethodNode,Long> {
    MethodNode findByName(@Param("name") String name);

    //模糊查询
    @Query("match (n:防治方法) where n.名称 =~ ('.*'+$likes+'.*') return n")
    List<MethodNode> findByNameLike(@Param("likes") String likes);
    //查询所有节点
    List<MethodNode> findAll();
}
